import { init, RematchDispatch, RematchRootState } from "@rematch/core";
import { models, RootModel } from "./models";

//创建 store，参数就是所有业务的 model
export const store = init({
    models
})

// store.subscribe( () => {
//     // console.log('store update >>> ' + JSON.stringify(store.getState()))
// })

// store.dispatch.music.updataCirculate(true)

//导出类型，用于业务组件里使用
export type Store = typeof store
export type Dispatch = RematchDispatch<RootModel>
export type RootState = RematchRootState<RootModel>